home *** CD-ROM | disk | FTP | other *** search
/ AGA Toolkit '97 / The AGA Toolkit '97.iso / programming / c / smc2cweb / example / example.c next >
Encoding:
C/C++ Source or Header  |  1996-09-07  |  1.2 KB  |  77 lines

  1. /* This file is part of the c2cweb package Version 1.4 */
  2. /* written by Werner Lemberg (a7621gac@awiuni11.bitnet) 20-Aug-1994 */
  3.  
  4. /* Grá Gott! */
  5.  
  6. /* this is an artificial example C-file to demonstrate how c2cweb works. Please
  7.    note the insertions of @ and @@ `commands' into the C code. You should try
  8.    the various switches to see how they influence the output */
  9.  
  10. /* Say
  11.  
  12.         c2cweb [options] example.h example.c
  13.  
  14.    to process this example. */
  15.  
  16.  
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include "example.h"
  20.  
  21. /*@*/
  22.  
  23. #define MAX_ARRAY 123
  24. #define test_function(a, b, c) (a+b+c)
  25.  
  26. int   dummy1; /* two dummy variables */
  27. float dummy2;
  28.  
  29. /*@*/
  30.  
  31. /* Two stupid functions */
  32.  
  33. #ifdef HELLO
  34. void say_hello(void);
  35. #else
  36. void say_goodbye(void);
  37. #endif
  38.  
  39. /*@@*/
  40.  
  41.  
  42. void main(void)
  43.    {int i=10000;
  44.     struct Test test;
  45.  
  46.     while(i--)
  47.         test.array[i]=i;
  48.  
  49. #ifdef HELLO
  50.     say_hello();
  51. #else
  52.     say_goodbye();
  53. #endif
  54.    }
  55.  
  56. /*@*/
  57.  
  58. union {
  59.     float another_dummy1;
  60.     int   another_dummy2;
  61. } AnotherTest;
  62.  
  63. /*@*/
  64.  
  65. #ifdef HELLO
  66. void say_hello(void)
  67.    {printf("\nHello\n");
  68.  
  69. // look at the unbalanced braces!
  70. // without insertion of /*}*/ right here c2cweb and CWEAVE would be confused
  71. /*}*/
  72. #else
  73. void say_goodbye(void)
  74.    {printf("\nGoodbye!\n");
  75. #endif
  76.    }
  77.